{% extends "personal_center/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/public_file/css/PersonnelChooser.css">
{% endblock %}


{% block style %}
    <style>
        .add_class{
            background: #1E90FF;
        }
        .add_background {
            background: #A9A9A9;
        }
        tr {
            height: 35px;
        }
        th {
            text-align: center;
        }
        table {
            table-layout: fixed;
        }
        td:first-child, th:first-child {
            position: sticky;left: 0;z-index: 1;
        }
        thead tr th {
            position: sticky;top: 0;background-color: #E8E8E8;
        }
        th:first-child {
            z-index: 2;
        }
        .li-class {
            list-style: none;margin-top: 2%;color: #0b0b0b;cursor: pointer;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .search {
            width: 300px;display: flex;float: right;margin: 10px 0;margin-right: 1%;
        }
        .search input {
            vertical-align: middle;float: left;height: 30px;width: 230px;outline: none;border: 1px solid #0070c1;box-sizing: border-box;border-bottom-left-radius: 3px;border-top-left-radius: 3px;
        }
        .search button {
            float: right;flex: 1;height: 30px;width: 70px;line-height: 30px;background-color: #0070c1;color: white;border-style: none;outline: none;border-bottom-right-radius: 3px;border-top-right-radius: 3px;
        }
        .search button i {
            font-style: normal;
        }
        .search button:hover {
            font-size: 16px;
        }
        #addForm {
            width: 600px;height: 400px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 10100;font-size: 0;
        }
        #title {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 40px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        .div_clase{
            display: inline-block;width: 300px;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;
        }
        .shade1 {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .search-input {
            width: 95%;height: 30px;border-radius: 3px;border: #cfcfcf solid 1px;background: url(../../static/personal_center/img/input_search.png) no-repeat 4px 5px;background-size: 8%;background-color: white;padding-left: 30px;outline: none;font-size: 14px;
        }
        #processed div {
            padding-left: 2%;
        }
        #processed div:hover {
            background: #cfcfcf;
        }
        #ThreeNavigation div {
            padding-left: 2%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 40px;background: white;border-bottom: #A9A9A9 solid 0.5px;line-height: 40px;padding-left: 1%;color: black;">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            党委
        </div>

        <div id="XZ_tag" class="tab_top" onclick="change_mind('XZ')">
            行政
        </div>

        <div id="LH_tag" class="tab_top" onclick="change_mind('LH')">
            行政例会
        </div>

        <div id="summit_button" style="float: right;width: 110px;text-align: center;height: 100%;">
            <button id="summ_id" onclick="summit_fun('a')" style="width: 100px;height: 30px;margin-top: 5px;border-radius: 3px;border: #1E90FF solid 1px;color: white;background-color: #1E90FF;line-height: 30px;">提&nbsp;&nbsp;交</button>
        </div>
        <div id="save_button" style="float: right;width: 110px;text-align: center;height: 100%;">
            <button id="save_id" onclick="save_fun()" style="width: 100px;height: 30px;margin-top: 5px;border-radius: 3px;border: #1E90FF solid 1px;color: white;background-color: #1E90FF;line-height: 30px;">保&nbsp;&nbsp;存</button>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 40px;background: white;">
        <div style="width: 100%;height: 40px;background: white;padding-left: 1%;">
            <div id="DW_jy_tag" class="tab_top top_tag" onclick="change_card('DW_jy')">纪要</div>
            <div id="DW_zt_tag" class="tab_top" onclick="change_card('DW_zt')">专题</div>
            <div id="DW_gw_tag" class="tab_top" onclick="change_card('DW_gw')">公文</div>
            <div id="DW_gqt_tag" class="tab_top" onclick="change_card('DW_gqt')">共青团</div>
        </div>
    </div>

    <div id="XZ" style="width: 100%;height: 40px;background: white;display: none;">
        <div style="width: 100%;height: 40px;background: white;padding-left: 1%;">
            <div id="XZ_jy_tag" class="tab_top top_tag" onclick="change_card1('XZ_jy')">纪要</div>
            <div id="XZ_zt_tag" class="tab_top" onclick="change_card1('XZ_zt')">专题</div>
            <div id="XZ_gw_tag" class="tab_top" onclick="change_card1('XZ_gw')">公文</div>
        </div>
    </div>
    <hr>

    <div id="text_div" style="width: 100%;height: 90%;background: white;">
        <div style="width: 100%;height: 40px;line-height: 50px;text-align: center;">
            <h3 id="manuscript_title" style="line-height: 50px;">党委会议纪要</h3>
        </div>
        <hr>
        <div style="width: 90%;margin-left: 5%;height: 90%;overflow: auto;margin-top: 1%;border-top: #cccccc solid 1px;">
            <div style="width: 100%;">
                <table id="fa_type" style="width: 100%;display: none;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">发文类型</td>
                        <td id="fwnx" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">
                            <span><input onclick="change_xz_gw_lx('1')" type="radio" name="XZ_gw_type" value="京医文" checked> 京医文</span>
                            <span style="margin-left: 15px;"><input onclick="change_xz_gw_lx('2')" type="radio" name="XZ_gw_type" value="京医发"> 京医发</span>
                        </td>
                        <td id="qf_td" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;display: none;">签发领导</td>
                        <td id="qf_td1" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;display: none;">
                            <select name="" id="qf_people" style="width: 100%;height: 100%;border: none;outline: none;">
                                <option value="">请选择签发领导</option>
                                {% for qf_leader in qf_leaders %}
                                    <option value="{{ qf_leader.id }}">{{ qf_leader.real_name }}</option>
                                {% endfor %}
                            </select>
                        </td>
                    </tr>
                </table>
                <table style="width: 100%;">
                    <tr id="qf_no" style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">拟稿科室</td>
                        <td id="ngks" style="width: 40%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ department }}</td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">拟稿人</td>
                        <td id="ngr" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ realname }}</td>
                        <td id="qf_td" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;display: none;"><span style="color: red;">* </span>签发领导</td>
                        <td id="qf_td1" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;display: none;">
                            <select name="" id="qf_leader" style="width: 100%;height: 100%;border: none;outline: none;">
                                <option value="">请选择签发领导</option>
                                <option value="梁东(6688)">梁东</option>
                                <option value="叶霖(6888)">叶霖</option>
                            </select>
                        </td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">文号</td>
                        <td id="gwwh" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ lh_Serial_number }}</td>
                    </tr>
                </table>
                <table id="fenguan_yes" style="width: 100%;display: none;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题</td>
                        <td id="gwbt1" style="width: 40%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">发起人</td>
                        <td id="fqr" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ realname }}</td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>分管领导</td>
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                            <select name="" id="fg_people" style="width: 100%;height: 100%;border: none;">
                                <option value="">请选择分管领导</option>
                                {% for leader in leaders %}
                                        <option value="{{ leader.id }}">{{ leader.real_name }}</option>
                                {% endfor %}
                            </select>
                        </td>
                    </tr>
                </table>
                <table style="width: 100%;">
                    <tr id="fenguan_no" style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题</td>
                        <td id="gwbt" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                    </tr>
                    <tr id="PrintingCopy" style="width: 100%;display: none;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>印&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;份</td>
                        <td id="yf" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>主&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送</td>
                        <td id="zs" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;visibility: hidden;">* </span>抄&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送</td>
                        <td id="cs" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                    </tr>
                    <tr id="Gist" style="width: 100%;display: none;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">依&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;据</td>
                        <td id="yj" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                    </tr>
                    <tr id="countersign" style="width: 100%;display: none;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">会签领导</td>
                        <td style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                            {% for jointly in sign_jointly %}
                                <div style="width: 80px;display: inline-block;vertical-align: top;"><input type="checkbox" class="read_leadership" value="{{ jointly.id }}"> {{ jointly.real_name }}</div>
                            {% endfor %}
                        </td>
                    </tr>
                </table>
            </div>
            <div style="width: 100%;">
                <div style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                    <span style="color: red;">* </span>上传文件
                    <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                        上传文件
                        <input type="file" name="regular_main_body" id="regular_main_body" onchange="upload_accessory('file1', 'regular_main', 'regular_main_body')">
                    </a>
                </div>
                <table style="width: 100%;">
                    <thead>
                        <tr>
                            <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件名称</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件大小</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传时间</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传人员</td>
                            <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作</td>
                        </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="regular_main"></tbody>
                </table>
            </div>
            <div id="DistributeFiles" style="width: 100%;display: none;">
                <div style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                    <span style="color: red;">* </span>分发文件
                    <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                        分发文件
                        <input type="file" name="distribute_files_body" id="distribute_files_body" onchange="upload_accessory('file2', 'distribute_files', 'distribute_files_body')">
                    </a>
                </div>
                <table style="width: 100%;">
                    <thead>
                        <tr>
                            <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件名称</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件大小</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传时间</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传人员</td>
                            <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作</td>
                        </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="distribute_files"></tbody>
                </table>
            </div>
        </div>
    </div>

    <div id="addForm-fenfa" class="shade1">
        <div id="addForm">
            <!-- 标题 -->
            <div id="title">
                <h5 style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;font-size: 14px;">选择科室</h5>
                <span onclick="close_models1()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="width: 55%;height: 350px;vertical-align: top;left: 0;display: inline-block;border-right: #cfcfcf solid 1px;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                    <input id="search_data1" onkeydown="search_dep()" class="search-input" type="text" placeholder="搜索" autocomplete="off">
                </div>
                <div id="processed" style="width: 100%;height: 300px;overflow: auto;">
                    {% for company in company_list %}
                        <div style="width: 100%;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;">
                            <input class="check_box1" id="{{ company.id }}" type="checkbox" onclick="check_dep_ff('{{ company.name }}', '{{ company.id }}')"> {{ company.name }}
                        </div>
                    {% endfor %}
                </div>
            </div>

            <div style="width: 43%;height: 360px;vertical-align: top;left: 0;display: inline-block;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;font-size: 14px;">
                    已选择科室
                </div>
                <div id="processed_prople" style="width: 100%;height: 265px;overflow: auto;padding-left: 2%;">

                </div>
                <div style="width: 100%;height: 40px;text-align: center;">
                    <button onclick="Distribution_department()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #1E90FF solid 1px;background: #1E90FF;color: white;width: 80px;letter-spacing: 4px;font-size: 14px;">
                        提交
                    </button>
                    <button onclick="close_models1()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #cfcfcf solid 1px;width: 80px;letter-spacing: 4px;margin-left: 15px;font-size: 14px;">
                        取消
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="staff-select" class="shade">
        <div id="staff-model" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 900px;height: 500px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="staff-box" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 20%;margin-left: 1%;display: inline-block;line-height: 40px;font-size: 14px;">
                        选择人员
                    </div>
                    <span onclick="close_model()" style="float: right;padding-right: 2%;cursor: pointer;line-height: 40px;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 460px;width: 100%;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 70px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div id="dep" class="navigation navigation_color" onclick="change_navigation(this)">部门</div>
                        <div id="limits" class="navigation" onclick="change_navigation(this)">权限</div>
                        <div id="fun" class="navigation" onclick="change_navigation(this)">职能</div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;">
                            <input id="SearchDep" onkeydown="SearchDepartment()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 95%;">
                        </div>
                        <div id="SecondaryNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                            <input type="checkbox" id="select-all" onclick="SelectAll(this)">
                            <input id="SearchPeo" onkeydown="SearchProple()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 87%;">
                        </div>
                        <div id="ThreeNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 370px;height: 100%;display: inline-block;vertical-align: top;overflow: auto">
                        <div style="width: 100%;height: 40px;text-align: left;font-size: 14px;line-height: 40px;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;已选 <span id="selected-number">0</span> 人
                        </div>
                        <div id="selected-div" style="width: 100%;font-size: 14px;height: 370px;overflow: auto;line-height: 20px;">

                        </div>
                        <div style="width: 100%;font-size: 14px;height: 40px;text-align: center;">
                            <button onclick="IdentifyPersonnel()" style="width: 100px;height: 30px;line-height: 25px;text-align: center;letter-spacing: 5px;border-radius: 3px;border: #cfcfcf solid 1px;font-size: 14px;cursor: pointer;margin-top: 10px;">完成</button>
                            <button onclick="close_model()" style="margin-left: 15px;width: 100px;height: 30px;line-height: 25px;text-align: center;color: #0abb78;letter-spacing: 5px;border-radius: 3px;font-size: 14px;border: #cfcfcf solid 1px;cursor: pointer;margin-top: 10px;">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}


{% block script %}
    <script src="../../static/public_file/js/PersonnelChoosersNew.js" type="text/javascript" charset="gb2312"></script>
    <script>
        window.onload = function () {
            document.getElementById("sponsor").className = "add_class";
            document.getElementById("personage").className = "add-nav-active";
            permissions_validation();
        };

        let title = document.querySelector("#title");
        let addForm = document.querySelector("#addForm");

        title.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm.offsetLeft;
            let y = e.pageY - addForm.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm.style.left = e.pageX - x + 'px';
                addForm.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        var department = "{{ department | safe }}";
        var realname = "{{ realname | safe }}";

        function show_model() {
            document.getElementById("addForm-fenfa").style.display="table-row";
        }

        function close_models1() {
            document.getElementById("addForm-fenfa").style.display = "none";
        }

        // 删除列表
        function deltr1() {
            var tb = document.getElementById('t_table2');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        var New_year = new Date().getFullYear();
        var returnData = {{ returnData | safe }};
        document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["a"]+'号';

        function change_xz_gw_lx(chose_num) {
            if (chose_num === '1'){
                document.getElementById("gwwh").innerText='京医文〔'+String(New_year)+'〕'+returnData['type']["h"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('h')");
            }else {
                document.getElementById("gwwh").innerText='京医发〔'+String(New_year)+'〕'+returnData['type']["f"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('f')");
            }
        }

        var company_list = {{ company_list | safe }};

        function search_dep(){
            var search_keyword = document.getElementById("search_data1").value;
            var processed = document.getElementById("processed");
            processed.innerHTML = "";
            console.log(company_list.length)
            for (var h=0; h<company_list.length; h++){
                if (company_list[h]["name"].indexOf(search_keyword) !== -1){
                    console.log(company_list[h]["name"])
                    var div_tag = document.createElement("div");div_tag.className="div_clase";
                    div_tag.innerHTML = '<input class="check_box1" id="'+company_list[h]["id"]+'" type="checkbox" onclick="check_dep_ff(\''+company_list[h]["name"]+'\', \''+company_list[h]["id"]+'\')"> '+ company_list[h]["name"];
                    processed.appendChild(div_tag)
                }
            }
        }

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                if (!permissions['党委']){
                    alert("您的访问权限不足!");
                    return false
                }
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("XZ_tag").className = "tab_top";
                document.getElementById("XZ").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("DW_jy_tag").className = "tab_top top_tag";
                document.getElementById("DW_zt_tag").className = "tab_top";
                document.getElementById("DW_gw_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="党委会议纪要";
                document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["a"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('a')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText=department;
                document.getElementById("ngks").removeAttribute("onclick");
                document.getElementById("ngr").innerText=realname;
                document.getElementById("ngr").removeAttribute("onclick");
                document.getElementById("PrintingCopy").style.display="none";
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('text_div').style.height="90%";
                document.getElementById("DistributeFiles").style.display="none";
            }else if (ele_id === "XZ"){
                if (!permissions['行政']){
                    alert("您的访问权限不足!");
                    return false
                }
                document.getElementById("XZ").style.display = "inline-block";
                document.getElementById("XZ_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("XZ_jy_tag").className = "tab_top top_tag";
                document.getElementById("XZ_zt_tag").className = "tab_top";
                document.getElementById("XZ_gw_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="院长办公会会议纪要";
                document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["b"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('b')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText=department;
                document.getElementById("ngks").removeAttribute("onclick");
                document.getElementById("ngr").innerText=realname;
                document.getElementById("ngr").removeAttribute("onclick");
                document.getElementById("PrintingCopy").style.display="none";
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('text_div').style.height="90%";
                document.getElementById("DistributeFiles").style.display="table-row";
            }else {
                if (!permissions['行政例会']){
                    alert("您的访问权限不足!");
                    return false
                }
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("XZ_tag").className = "tab_top";
                document.getElementById("XZ").style.display = "none";
                document.getElementById("manuscript_title").innerText="行政例会简报";
                document.getElementById("gwwh").innerText='行政例会〔'+String(New_year)+'〕'+returnData['type']["e"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('e')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText=department;
                document.getElementById("ngks").removeAttribute("onclick");
                document.getElementById("ngr").innerText=realname;
                document.getElementById("ngr").removeAttribute("onclick");
                document.getElementById("PrintingCopy").style.display="none";
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('text_div').style.height="95%";
                document.getElementById("DistributeFiles").style.display="none";
            }
        }

        function change_card(ele_tag) {
            if (ele_tag === "DW_jy") {
                document.getElementById("DW_jy_tag").className = "tab_top top_tag";
                document.getElementById("DW_zt_tag").className = "tab_top";
                document.getElementById("DW_gw_tag").className = "tab_top";
                document.getElementById("DW_gqt_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="党委会议纪要";
                document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["a"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('a')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText=department;
                document.getElementById("ngks").removeAttribute("onclick");
                document.getElementById("ngr").innerText=realname;
                document.getElementById("ngr").removeAttribute("onclick");
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('countersign').style.display = 'none';
            }else if (ele_tag === "DW_zt") {
                document.getElementById("DW_zt_tag").className = "tab_top top_tag";
                document.getElementById("DW_jy_tag").className = "tab_top";
                document.getElementById("DW_gw_tag").className = "tab_top";
                document.getElementById("DW_gqt_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="党委专题会议纪要";
                document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["c"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('c')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText='';
                document.getElementById("ngks").setAttribute("onclick", 'show_model()');
                document.getElementById("ngr").innerText='';
                document.getElementById("ngr").setAttribute("onclick", 'model_line()');
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('countersign').style.display = 'none';
            }else if (ele_tag === "DW_gw")  {
                document.getElementById("DW_gw_tag").className = "tab_top top_tag";
                document.getElementById("DW_jy_tag").className = "tab_top";
                document.getElementById("DW_zt_tag").className = "tab_top";
                document.getElementById("DW_gqt_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="党委公文";
                document.getElementById("gwwh").innerText='京医党发〔'+String(New_year)+'〕'+returnData['type']["g"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('g')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_no").style.display="none";
                document.getElementById("fenguan_yes").style.display="table";
                document.getElementById("ngks").innerText='';
                document.getElementById("ngks").setAttribute("onclick", 'show_model()');
                document.getElementById("ngr").innerText='';
                document.getElementById("ngr").setAttribute("onclick", 'model_line()');
                document.getElementById('Gist').style.display = 'table-row';
                document.getElementById('countersign').style.display = 'none';
            }else {
                document.getElementById("DW_gqt_tag").className = "tab_top top_tag";
                document.getElementById("DW_gw_tag").className = "tab_top";
                document.getElementById("DW_jy_tag").className = "tab_top";
                document.getElementById("DW_zt_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="京医团总支发文";
                document.getElementById("gwwh").innerText='京医团总支发〔'+String(New_year)+'〕'+returnData['type']["i"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('i')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_no").style.display="none";
                document.getElementById("fenguan_yes").style.display="table";
                document.getElementById("ngks").innerText='';
                document.getElementById("ngks").setAttribute("onclick", 'show_model()');
                document.getElementById("ngr").innerText='';
                document.getElementById("ngr").setAttribute("onclick", 'model_line()');
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('countersign').style.display = 'none';
            }
        }

        function check_dep_ff(ele_name, ele_id) {
            var processed_prople = document.getElementById("processed_prople");
            {#var span = document.createElement("span");#}
            console.log(document.getElementById(ele_id).checked)
            if (!document.getElementById(ele_id).checked){
                document.getElementById(ele_id).checked = false;
                processed_prople.innerText = "";
            }
            if (document.getElementById(ele_id).checked){
                {#span.innerText=ele_name;span.setAttribute("id", 'cc-'+ele_id);span.style.fontSize='14px';span.style.marginLeft="10px";#}
                processed_prople.innerText = ele_name;processed_prople.style.color='#4169E1';processed_prople.style.fontSize='14px';
                check_more_one_not1(ele_id);
            }
        }

        function Distribution_department() {
            var processed_prople = document.getElementById("processed_prople").innerText;

            if (!processed_prople){
                alert("请选择拟稿科室！");
                return false
             }
            close_models1()
            document.getElementById("ngks").innerText=processed_prople;
         }

        function change_card1(ele_tag) {
            if (ele_tag === "XZ_jy") {
                document.getElementById("XZ_jy_tag").className = "tab_top top_tag";
                document.getElementById("XZ_zt_tag").className = "tab_top";
                document.getElementById("XZ_gw_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="院长办公会会议纪要";
                document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["b"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('b')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText=department;
                document.getElementById("ngks").removeAttribute("onclick");
                document.getElementById("ngr").innerText=realname;
                document.getElementById("ngr").removeAttribute("onclick");
                document.getElementById("PrintingCopy").style.display="none";
                document.getElementById('Gist').style.display = 'none';
                document.getElementById('DistributeFiles').style.display = 'table-row';
                document.getElementById('countersign').style.display = 'none';
            }else if (ele_tag === "XZ_zt") {
                document.getElementById("XZ_zt_tag").className = "tab_top top_tag";
                document.getElementById("XZ_jy_tag").className = "tab_top";
                document.getElementById("XZ_gw_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="院长办公会专题会议纪要";
                document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["d"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('d')");
                document.getElementById("fa_type").style.display="none";
                document.getElementById("fenguan_yes").style.display="none";
                document.getElementById("fenguan_no").style.display="table-row";
                document.getElementById("ngks").innerText=department;
                document.getElementById("ngks").removeAttribute("onclick");
                document.getElementById("ngr").innerText=realname;
                document.getElementById("ngr").removeAttribute("onclick");
                document.getElementById("PrintingCopy").style.display="none";
                document.getElementById('Gist').style.display = 'none';
                document.getElementById("DistributeFiles").style.display="none";
                document.getElementById('countersign').style.display = 'table-row';
            }else {
                document.getElementById("XZ_gw_tag").className = "tab_top top_tag";
                document.getElementById("XZ_jy_tag").className = "tab_top";
                document.getElementById("XZ_zt_tag").className = "tab_top";
                document.getElementById("manuscript_title").innerText="行政公文";
                document.getElementById("fa_type").style.display="table";
                document.getElementById("gwwh").innerText='京医文〔'+String(New_year)+'〕'+returnData['type']["h"]+'号';
                document.getElementById("summ_id").setAttribute("onclick", "summit_fun('h')");
                document.getElementById("fenguan_no").style.display="none";
                document.getElementById("fenguan_yes").style.display="table";
                document.getElementById("ngks").innerText='';
                document.getElementById("ngks").setAttribute("onclick", 'show_model()');
                document.getElementById("ngr").innerText='';
                document.getElementById("ngr").setAttribute("onclick", 'model_line()');
                document.getElementById("PrintingCopy").style.display="table-row";
                document.getElementById('Gist').style.display = 'table-row';
                document.getElementById('DistributeFiles').style.display = 'none';
                document.getElementById('countersign').style.display = 'none';
                var audit_result = $("input[type=radio][name=XZ_gw_type]:checked").val();
                if (audit_result === '京医文'){
                    document.getElementById("fwnx").style.width="85%";
                    {#document.getElementById("qf_td").style.display="table-cell";#}
                    {#document.getElementById("qf_td1").style.display="table-cell";#}
                }
                if (audit_result === '京医发'){
                    document.getElementById("fwnx").style.width="85%";
                    {#document.getElementById("qf_td").style.display="none";#}
                    {#document.getElementById("qf_td1").style.display="none";#}
                }
            }
        }

        function change_card2(ele_tag) {
            document.getElementById("manuscript_title").innerText="行政例会简报";
            document.getElementById("gwwh").innerText='行政例会〔'+String(New_year)+'〕'+returnData['type']["e"]+'号';
            document.getElementById("summ_id").setAttribute("onclick", "summit_fun('e')");
            document.getElementById("fa_type").style.display="none";
            document.getElementById("fenguan_yes").style.display="none";
            document.getElementById("fenguan_no").style.display="table-row";
            document.getElementById("ngks").innerText=department;
            document.getElementById("ngks").removeAttribute("onclick");
            document.getElementById("ngr").innerText=realname;
            document.getElementById("ngr").removeAttribute("onclick");
        }

        function summit_fun(gw_type) {
            var re = /^[0-9]+.?[0-9]*/;//判断字符串是否为数字//判断正整数/[1−9]+[0−9]∗]∗/

            var number = returnData["number"];
            var ngks = document.getElementById("ngks").innerText;
            var ngr = document.getElementById("ngr").innerText;
            var gwwh = document.getElementById("gwwh").innerText;
            var gwbt = document.getElementById("gwbt").innerText;
            var yf = document.getElementById("yf").innerText;
            var zs = document.getElementById("zs").innerText;
            var cs = document.getElementById("cs").innerText;
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;

            var qf_myselect = document.getElementById("qf_people");
            var qf_index = qf_myselect.selectedIndex;
            var qf_people = qf_myselect.options[qf_index].value;
            if (gw_type === 'f' || gw_type === 'g' || gw_type === 'h' || gw_type === 'i'){
                gwbt = document.getElementById("gwbt1").innerText;
                if (!fg_people){
                    alert("分管领导不能为空！")
                    return false
                }
                if (!ngr){
                     alert("请选择拟稿人！")
                    return false
                }
            }
            if (!zs){
                alert("主送不能为空！")
                return false
            }
            if (!gwbt){
                alert("标题不能为空！")
                return false
            }
            var t_table = document.getElementById('regular_main').childNodes.length;
            if (t_table === 0){
                alert("请上传正文！")
                return false
            }
            var read_leadership_list = document.getElementsByClassName('read_leadership');
            var leaders_id_str = '';
            for (var id_str=0; id_str<read_leadership_list.length; id_str++) {
                if (read_leadership_list[id_str].checked) {
                    leaders_id_str = leaders_id_str + read_leadership_list[id_str].value + ','
                }
            }

            if (gw_type === 'h' || gw_type === 'g' || gw_type === 'f') {
                var yj = document.getElementById("yj").innerText;
                var send_str = "type=" + String(gw_type) + "&document_number=" + gwwh + "&number=" + number + "&main_company=" + zs +
                    "&vice_company=" + cs + "&servings=" + yf + "&conference_memo_text=" + gwbt + "&fg_people=" + fg_people +
                    "&drafter=" + String(ngr) + "&drafter_company=" + String(ngks)+"&qf_people="+String(qf_people)+"&gist="+yj;
                console.log("send_str: ", send_str)
            } else {
                send_str = "type=" + String(gw_type) + "&document_number=" + gwwh + "&number=" + number + "&main_company=" + zs +
                    "&vice_company=" + cs + "&servings=" + yf + "&conference_memo_text=" + gwbt + "&fg_people=" + fg_people +
                    "&drafter=" + String(ngr) + "&drafter_company=" + String(ngks)+"&qf_people="+String(qf_people);
                console.log("send_str: ", send_str)
            }

            if (!leaders_id_str && gw_type === 'd') {
                alert("请选择会签人员！")
                return false
            }
            send_str = send_str + "&leaders_id_str=" + leaders_id_str
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/conference_memo_index_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send(send_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate['code']===200) {
                            alert("提交成功！")
                            window.location.href = "/personal-center/my_draft.html";
                        }else {
                            alert(JsonDate['message'])
                        }
                    }
                }
             };
        }

        function save_fun() {
            var gw_type = $('#manuscript_title').text()
            var type_str = 'a'
            if (gw_type === '党委会议纪要'){
                type_str = 'a'
            }
            if (gw_type === '党委专题会议纪要'){
                type_str = 'c'
            }
            if (gw_type === '党委公文'){
                type_str = 'g'
            }
            if (gw_type === '院长办公会会议纪要'){
                type_str = 'b'
            }
            if (gw_type === '行政公文'){
                var temp = $("input[type=radio][name=XZ_gw_type]:checked").val()
                if (temp === '京医文'){
                type_str = 'h'}else {
                    type_str = 'f'
                }
            }
            if (gw_type === '行政例会简报'){
                type_str = 'e'
            }
            if (gw_type === '京医团总支发文') {
                type_str = 'i'
            }
            if (gw_type === '院长办公会专题会议纪要') {
                type_str = 'd'
            }
            var re = /^[0-9]+.?[0-9]*/;//判断字符串是否为数字//判断正整数/[1−9]+[0−9]∗]∗/

            var number = returnData["number"];
            var ngks = document.getElementById("ngks").innerText;
            var ngr = document.getElementById("ngr").innerText;
            var gwwh = document.getElementById("gwwh").innerText;
            var gwbt = document.getElementById("gwbt").innerText;
            var yf = document.getElementById("yf").innerText;
            var zs = document.getElementById("zs").innerText;
            var cs = document.getElementById("cs").innerText;
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            var qf_myselect = document.getElementById("qf_people");
            var qf_index = qf_myselect.selectedIndex;
            var qf_people = qf_myselect.options[qf_index].value;
            if (type_str === 'f' || type_str === 'g' || type_str === 'h'){
                gwbt = document.getElementById("gwbt1").innerText;
            }
            var t_table = document.getElementById('regular_main').childNodes.length;
            document.getElementById("loading").style.display = "inline-block";
            if (type_str === 'h' || type_str === 'g' || type_str === 'f') {
                var yj = document.getElementById("yj").innerText;
                var send_str = "type=" + String(type_str) + "&document_number=" + gwwh + "&number=" + number + "&main_company=" + zs +
                    "&vice_company=" + cs + "&servings=" + yf + "&conference_memo_text=" + gwbt + "&fg_people=" + fg_people +
                    "&drafter=" + String(ngr) + "&drafter_company=" + String(ngks)+"&qf_people="+String(qf_people)+"&gist="+yj;
            } else {
                send_str = "type=" + String(type_str) + "&document_number=" + gwwh + "&number=" + number + "&main_company=" + zs +
                    "&vice_company=" + cs + "&servings=" + yf + "&conference_memo_text=" + gwbt + "&fg_people=" + fg_people +
                    "&drafter=" + String(ngr) + "&drafter_company=" + String(ngks)+"&qf_people="+String(qf_people);
            }
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/conference_memo_draft_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send(send_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate['code']===200) {
                            alert(JsonDate['message'])
                            window.location.href = "/personal-center/my_draft.html";
                        }else {
                            alert(JsonDate['message'])
                        }
                    }
                }
             };
        }

        function upload_accessory(file_type, tbody_id, accessory_type) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', returnData["number"])
            form.append("source", "gw")
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        creat_table(JsonDate, tbody_id);
                        document.getElementById("regular_main_body").value="";
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData, tbody_id) {
            var t_table = document.getElementById(tbody_id);
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])){
                for (var i=0; i<JsonData["pdf_path"].length; i++){
                    var tr = document.createElement("tr");
                    var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length+1;td1.style.textAlign = "center";td1.style.border="#cccccc solid 1px";td1.style.borderTop="none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border="#cccccc solid 1px";td2.style.borderLeft="none";td2.style.borderTop="none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border="#cccccc solid 1px";td3.style.borderLeft="none";td3.style.borderTop="none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border="#cccccc solid 1px";td4.style.borderLeft="none";td4.style.borderTop="none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border="#cccccc solid 1px";td5.style.borderLeft="none";td5.style.borderTop="none";
                    td6.innerHTML = "<a target='_blank' href='"+JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \""+tbody_id+"\", \""+JsonData["pdf_path"][i]["id"]+"\")'>删除</a>";td6.style.textAlign = "center";td6.style.border="#cccccc solid 1px";td6.style.borderLeft="none";td6.style.borderTop="none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                    t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1){
                    document.getElementById("del_adjunct").style.display='block';
                }
            }else {
                var tr = document.createElement("tr");
                var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length+1;td1.style.textAlign = "center";td1.style.border="#cccccc solid 1px";td1.style.borderTop="none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border="#cccccc solid 1px";td2.style.borderLeft="none";td2.style.borderTop="none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border="#cccccc solid 1px";td3.style.borderLeft="none";td3.style.borderTop="none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border="#cccccc solid 1px";td4.style.borderLeft="none";td4.style.borderTop="none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border="#cccccc solid 1px";td5.style.borderLeft="none";td5.style.borderTop="none";
                td6.innerHTML = "<a target='_blank' href='"+JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \""+tbody_id+"\", \""+JsonData["id"]+"\")'>删除</a>";td6.style.textAlign = "center";td6.style.border="#cccccc solid 1px";td6.style.borderLeft="none";td6.style.borderTop="none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                t_table.appendChild(tr);
            }
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i=0; i<table.children.length; i++){
                table.children[i].children[0].innerHTML=i+1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        function permissions_validation() {
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/permissions_validation");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("permissions_type=公文发文");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        permissions = JsonDate['permissions'];
                        if (permissions['党委']){
                            document.getElementById("DW").style.display = "inline-block";
                            document.getElementById("DW_tag").className = "tab_top top_tag";
                            document.getElementById("XZ_tag").className = "tab_top";
                            document.getElementById("XZ").style.display = "none";
                            document.getElementById("LH_tag").className = "tab_top";
                            document.getElementById("DW_jy_tag").className = "tab_top top_tag";
                            document.getElementById("DW_zt_tag").className = "tab_top";
                            document.getElementById("DW_gw_tag").className = "tab_top";
                            document.getElementById("manuscript_title").innerText="党委会议纪要";
                            document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["a"]+'号';
                            document.getElementById("summ_id").setAttribute("onclick", "summit_fun('a')");
                            document.getElementById("fa_type").style.display="none";
                            return false
                        }
                        if (permissions['行政']){
                            document.getElementById("XZ").style.display = "inline-block";
                            document.getElementById("XZ_tag").className = "tab_top top_tag";
                            document.getElementById("DW_tag").className = "tab_top";
                            document.getElementById("DW").style.display = "none";
                            document.getElementById("LH_tag").className = "tab_top";
                            document.getElementById("XZ_jy_tag").className = "tab_top top_tag";
                            document.getElementById("XZ_zt_tag").className = "tab_top";
                            document.getElementById("XZ_gw_tag").className = "tab_top";
                            document.getElementById("manuscript_title").innerText="院长办公会会议纪要";
                            document.getElementById("gwwh").innerText='会议纪要〔'+String(New_year)+'〕'+returnData['type']["b"]+'号';
                            document.getElementById("summ_id").setAttribute("onclick", "summit_fun('b')");
                            document.getElementById("fa_type").style.display="none";
                            document.getElementById('DistributeFiles').style.display = 'table-row';
                            return false
                        }
                        if (permissions['行政例会']){
                            document.getElementById("LH_tag").className = "tab_top top_tag";
                            document.getElementById("DW_tag").className = "tab_top";
                            document.getElementById("DW").style.display = "none";
                            document.getElementById("XZ_tag").className = "tab_top";
                            document.getElementById("XZ").style.display = "none";
                            document.getElementById("manuscript_title").innerText="行政例会简报";
                            document.getElementById("gwwh").innerText='行政例会〔'+String(New_year)+'〕'+returnData['type']["e"]+'号';
                            document.getElementById("summ_id").setAttribute("onclick", "summit_fun('e')");
                            document.getElementById("fa_type").style.display="none";
                            return false
                        }
                    }
                }
             };
        }

        // checkBox不允许多选
        function check_more_one_not1(ele_id) {
            var check_box_list = document.getElementsByClassName("check_box1");
            for (var i = 0; i < check_box_list.length; i++) {
                if (String(check_box_list[i].id) !== String(ele_id)) {
                    document.getElementById(check_box_list[i].id).checked = false;
                } else {
                    document.getElementById(check_box_list[i].id).checked = true;
                }
            }
        }

        function IdentifyPersonnel() {
            var prople_list = [];
            var selected_personnel_list = document.getElementsByClassName('selected-personnel');
            for (var i=0; i<selected_personnel_list.length; i++) {
                prople_list.push(selected_personnel_list[i].innerText)
            }
            document.getElementById("ngr").innerText = prople_list[0].split("(")[0];
            close_model()
        }

        function scrollConversationScreen() {
            $('#selected-div').scrollTop($('#selected-div')[0].scrollHeight);
        }
    </script>
{% endblock %}
